import request from '@/utils/request';

// 采购订单列表
export function orderList(data) {
    return request({
        url: '/system/purchaseOrder/list',
        method: 'get',
        params: data
    })
}

// 新建采购订单
export function orderAdd(data) {
    return request({
        url: '/system/purchaseOrder/insert',
        method: 'post',
        data: data
    })
}

// 编辑采购订单
export function orderEdit(data) {
    return request({
        url: '/system/purchaseOrder/update',
        method: 'post',
        data: data
    })
}

// 删除商品
export function orderDelete(id) {
    return request({
        url: '/system/purchaseOrder/remove?id=' + id,
        method: 'post'
    })
}

// 删除商品
export function delProduct(id) {
    return request({
        url: '/system/purchaseOrderProduct/deleteById?id=' + id,
        method: 'post'
    })
}

// 查询销售订单详细信息
export function orderDetail(id) {
    return request({
        url: '/system/purchaseOrder/selectOne?id=' + id,
        method: 'get'
    })
}

// 审核/反审核
export function orderApprove(id, status, approvalStatus, oldApprovalStatus, approveRemark) {
    const data = {
        id,
        status,
        approvalStatus,
        oldApprovalStatus,
        approveRemark
    }
    return request({
        url: '/system/purchaseOrder/approval',
        method: 'post',
        data: data
    })
}

// 根据sku查询
export function orderSearch() {
    return request({
        url: '/system/productBasicInformation/selectProductSpecifications',
        method: 'get'
    })
}

// 查询批次号
export function orderBatchNumber(id) {
    return request({
        url: '/system/productStore/list?productId=' + id,
        method: 'get'
    })
}